from OpenGL.GL import *
import pyglet

from common import *
from game.core.gamemanager import GameManager

class StatusBar(object):
    """
    This class represents the status bar.
    """
    
    def __init__(self):
        # Creates the logo sprite
        img = pyglet.image.load('../data/images/status/bg_status.jpg')
        self.base = pyglet.sprite.Sprite(img,
                    x=GameManager.main_window.win.width / 2, y=0)
        
        self.nandocarium_img = pyglet.image.load('../data/images/status/nandocarium.png')
        self.nandocarium = pyglet.text.Label(text="550", x=40, y=20, font_size=14, color = (255, 255, 255, 200), bold = 1) 
          
    def render(self):
        glDisable(GL_LIGHTING)
        glColor(1, 1, 1)
        repeat_num = GameManager.main_window.win.width / self.base.image.width + 1
        for i in range(repeat_num):
            self.base.x = i * self.base.image.width
            self.base.draw()
        self.nandocarium_img.blit(10,15,0)
        self.nandocarium.draw()
        glEnable(GL_LIGHTING)